#include"stdafx.h"
#include"chatGroupZYZ.h"
#include"accountStateZYZ.h"
#include"accountZYZ.h"
#include"WeChatGroupZYZ.h"

chatGroupZYZ* currGroup;
extern accountZYZ currAccount;





bool chatGroupZYZ::exists(int id)
{
	for (auto i : memberIDs)
	{
		if (id == i)
			return true;
	}
	return false;
}


bool chatGroupZYZ::findGroup(std::string servicename, int ID)
{
		std::ifstream file;
		file.open(SERVICE_DIR + servicename + 
			"/groups/" + std::to_string(ID) 
			+ INFO_FILE);
		if (file.is_open())
		{
			file.close();
			return true;
		}
		else
		{
			file.close();
			return false;
		}
}

chatGroupZYZ::chatGroupZYZ()
{
	groupID = 1000;
	groupName = "default";
}

chatGroupZYZ::chatGroupZYZ(int gID, 
	std::string gName, 
	int masterID, 
	std::set<int> memberID)
{
	this->groupID = gID;
	this->groupName = gName;
	this->masterID = masterID;
	this->memberIDs = memberID;
}
